
package cn.com.cifi.mars.web.action.operateplan;

import cn.com.cifi.mars.bean.param.returnPlan.ReturnPlanApprovalSubmitParam;
import cn.com.cifi.mars.bean.param.returnPlan.ReturnPlanCreateParam;
import cn.com.cifi.mars.bean.param.returnPlan.ReturnPlanDetailSaveParam;
import cn.com.cifi.mars.bean.vo.returnPlan.*;
import cn.com.cifi.mars.common.bean.R;
import cn.com.cifi.mars.common.constants.VersionConstant;
import cn.com.cifi.mars.entity.PortalTodo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.Api;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 类名称：IReturnPlanController
 * 类描述：回款计划API 
 * 创建人：yyd 
 * 创建时间：2019年9月4日 上午10:45:53
 * 
 * @version 1.0.0
 */
@Api(tags = "回款计划API")
@RequestMapping("/${spring.data.rest.base-path}/{apiVersion}/returnPlan")
public interface IReturnPlanController {

    @ApiOperation(value = "获取新建来源数据", notes = "获取新建来源数据")
    @GetMapping(value = "/createSourceData")
    R<ReturnCreateSourceDataVo> createSourceData(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "分期ID", required = true) @RequestParam(value = "stageId") String stageId,
            @ApiParam(value = "版本类型(investment-投资版 、strategy-战规版 、budget-预算版 、dynamic-动态版)", required = true)
            @RequestParam(name = "versionType") String versionType);

    @ApiOperation(value = "新建回款计划", notes = "新建回款计划")
    @PostMapping(value = "/create")
    R create(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "回款计划创建参数", required = true) @RequestBody ReturnPlanCreateParam param);

    @ApiOperation(value = "异常新建回款计划", notes = "异常新建回款计划")
    @PostMapping(value = "/exceptionCreate")
    R exceptionCreate(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "回款计划创建参数", required = true) @RequestBody ReturnPlanCreateParam param);

    @ApiOperation(value = "查询分期最新版本类型", notes = "查询分期最新版本类型")
    @GetMapping(value = "newVersionType")
    R newVersionType(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "分期ID", required = true) @RequestParam(value = "stageId") String stageId);

    @ApiOperation(value = "查询回款计划版本数据列表", notes = "查询回款计划版本数据列表")
    @GetMapping(value = "/returnPlanVersionDataList")
    R<List<ReturnPlanVersionDataVo>> returnPlanVersionDataList(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "分期ID", required = true) @RequestParam(value = "stageId") String stageId,
            @ApiParam(value = "版本类型(investment-投资版 、strategy-战规版 、budget-预算版 、dynamic-动态版)", required = true)
            @RequestParam(name = "versionType") String versionType);

    @ApiOperation(value = "查看回款计划年份列表", notes = "查看回款计划年份列表")
    @GetMapping(value = "/yearList")
    R<List<String>> yearList(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "版本Id", required = true) @RequestParam(value = "versionId") String versionId);

    @ApiOperation(value = "查看回款计划一年数据", notes = "查看回款计划一年数据")
    @GetMapping(value = "/annualData")
    R<List<ReturnPlanYearDataVo>> annualData(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "版本Id", required = true) @RequestParam(value = "versionId") String versionId,
            @ApiParam(value = "查询年份", required = false) @RequestParam(value = "year") String year);

    @ApiOperation(value = "查询回款计划待办", notes = "查询回款计划待办")
    @GetMapping(value = "/portalTodo")
    R<PortalTodo> getPortalTodo(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "分期id+版本类型code", required = true) @RequestParam(value = "combinationId") String combinationId);

    @ApiOperation(value = "删除回款计划", notes = "删除回款计划")
    @DeleteMapping(value = "/del")
    R del(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "版本Id", required = true) @RequestParam(value = "versionId") String versionId);

    @ApiOperation(value = "查询回款计划编辑页面数据", notes = "查询回款计划编辑页面数据")
    @GetMapping(value = "/editDataList")
    R<ReturnPlanEditDataVo> editDataList(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "版本Id", required = true) @RequestParam(value = "versionId") String versionId,
            @ApiParam(value = "组团id", required = true) @RequestParam(value = "groupId") String groupId);

    @ApiOperation(value = "回款计划编辑页面保存", notes = "回款计划编辑页面保存")
    @PutMapping(value = "/editSave")
    R<String> editSave(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "保存参数", required = true) @RequestBody List<ReturnPlanDetailSaveParam> paramList);


    @ApiOperation(value = "回款计划编辑页面组团列表", notes = "回款计划编辑页面组团列表")
    @GetMapping(value = "/groupList")
    R<List<ReturnPlanGroupVo>> groupList(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "版本id", required = true) @RequestParam String versionId);


    @ApiOperation(value = "回款计划编辑页面全盘概览", notes = "回款计划编辑页面全盘概览")
    @GetMapping(value = "/fullOverview")
    R<List<ReturnPlanOverviewDataVo>> fullOverview(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "版本id", required = true) @RequestParam String versionId,
            @ApiParam(value = "年份", required = true) @RequestParam String year,
            @ApiParam(value = "月份", required = true) @RequestParam String month);

    @ApiOperation(value = "回款计划编辑页面回款系数", notes = "回款计划编辑页面回款系数")
    @GetMapping(value = "/returnCoefficientDetailList")
    R<List<ReturnPlanReturnCoefficientDetailVo>> returnCoefficientDetailList(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "版本id", required = true) @RequestParam String versionId);

    @ApiOperation(value = "设置考核版", notes = "设置考核版")
    @GetMapping(value = "assessment")
    R assessment(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "版本id", required = true) @RequestParam String versionId);

    @ApiOperation(value = "查看全盘回款计划年份列表", notes = "查看全盘回款计划年份列表")
    @GetMapping(value = "/overallYearList")
    R<List<String>> overallYearList(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "项目Id", required = true) @RequestParam(value = "projectId") String projectId);

    @ApiOperation(value = "查看全盘回款计划一年数据", notes = "查看全盘回款计划一年数据")
    @GetMapping(value = "/overallAnnualData")
    R<List<ReturnPlanYearDataVo>> overallAnnualData(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "项目Id", required = true) @RequestParam(value = "projectId") String projectId,
            @ApiParam(value = "查询年份", required = false) @RequestParam(value = "year") String year);

    @ApiOperation(value = "审批校验", notes = "审批校验")
    @GetMapping(value = "approvedCheck")
    R<Map<String, Boolean>> approvedCheck(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "项目id" ,required = true) @RequestParam(name = "projectId") String projectId
    );

    @ApiOperation(value = "查询回款计划审批预览数据PC", notes = "查询回款计划审批预览PC")
    @GetMapping(value = "approvalPreviewPC")
    R<ReturnPlanApprovalPreviewVo> approvalPreviewPC(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "项目Id", required = false) @RequestParam(value = "projectId",defaultValue = "") String projectId,
            @ApiParam(value = "审批单Id", required = false) @RequestParam(value = "approvalId",defaultValue = "") String approvalId
    );

    @ApiOperation(value = "查询回款计划审批预览数据App", notes = "查询回款计划审批预览数据App")
    @GetMapping(value = "approvalPreviewApp")
    R<ReturnPlanApprovalPreviewVo> approvalPreviewApp(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "项目Id", required = false) @RequestParam(value = "projectId",defaultValue = "") String projectId,
            @ApiParam(value = "审批单Id", required = false) @RequestParam(value = "approvalId",defaultValue = "") String approvalId
    );

    @ApiOperation(value = "审批提交", notes = "审批提交")
    @PostMapping(value = "approvalSubmit")
    R<String> approvalSubmit(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "审批提交参数", required = false)@RequestBody ReturnPlanApprovalSubmitParam param);


    @ApiOperation(value = "导出回款计划版本报表", notes = "导出回款计划版本报表")
    @GetMapping(value = "returnPlanVersionExport")
    void returnPlanVersionExport(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            HttpServletResponse response,
            @ApiParam(value = "版本id", required = true) @RequestParam(value = "versionId") String versionId);

    @ApiOperation(value = "导出项目全盘回款计划版本报表", notes = "导出项目全盘回款计划版本报表")
    @GetMapping(value = "returnOverallPlanVersionExport")
    void returnOverallPlanVersionExport(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            HttpServletResponse response,
            @ApiParam(value = "项目id", required = true) @RequestParam(value = "projectId") String projectId);
    
    @ApiOperation(value = "手动复制一版为预算版本", notes = "手动复制一版为预算版本")
  	@GetMapping(value = "copyBudgetVersion")
  	R copyBudgetVersion(
  			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
  			@ApiParam(value = "版本id", required = true) @RequestParam(value = "versionId", required = true) String versionId);

    @ApiOperation(value = "手动复制版本", notes = "手动复制版本")
  	@GetMapping(value = "copyReturnPlanVersion")
  	R copyReturnPlanVersion(
  			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
  			@ApiParam(value = "版本id", required = true) @RequestParam(value = "versionId", required = true) String versionId);

    


    //////////////////////////////////////////////////////////////////////////////////////////////////////////////

    @ApiOperation(value = "回款计划版本修改状态(测试使用)", notes = "回款计划版本修改状态（测试使用）")
    @PutMapping(value = "updateState")
    R updateState(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "版本Ids", required = true) @RequestParam(name = "versionIds") List<String> versionIds,
            @ApiParam(value = "版本状态", required = true) @RequestParam(name = "versionState") String versionState);


    @ApiOperation(value = "发送回款代办",notes = "发送回款代办")
    @GetMapping(value = "refreshReturnNoticeDispose")
    R returnNoticeDispose(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "签约版本id", required = true) @RequestParam String signId);

    @ApiOperation(value = "手动消除回款代办",notes = "手动消除回款代办\n"+
            "1:发起流程\n"+
            "2:流程更新\n"+
            "3:删除待办\n"+
            "4:待办转已办\n"+
            "5:抄送新增\n"+
            "6:抄送处理"
    )
    @GetMapping(value = "refreshDeleteTodoInfo")
    R deleteTodoInfo(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "分期id+版本类型(investment-投资版 、strategy-战规版 、budget-预算版 、dynamic-动态版)", required = true) @RequestParam String id,
            @ApiParam(value = "处理方式(1;2;3;4;5;6)", required = true) @RequestParam String operatorType);


    @ApiOperation(value = "同步明源回款数据", notes = "同步明源回款数据\n"+
            "v1 : 全量刷新\n" +
            "v2 : 指定分期刷新")
    @GetMapping(value = "syncMyReturnData")
    R syncMyReturnData(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "分期id", required = false)  @RequestParam(value = "stageId",required = false) String stageId);

}
